package com.tg.message.adapter;

import android.annotation.SuppressLint;

import androidx.annotation.NonNull;

import com.tg.data.http.entity.WheelData;

import java.util.List;

public class MessageDateAdapter extends DateAdapter{
    private final List<WheelData> wheelDataList;
    public MessageDateAdapter(List<WheelData> data) {
        wheelDataList = data;
    }

    @Override
    public void onBindViewHolder(@NonNull MessageDateAdapter.MessageDateViewHolder holder, @SuppressLint("RecyclerView") final int position) {
        WheelData wheelData = wheelDataList.get(position);
        holder.dateText.setText(getDateText(wheelData));
        super.onBindViewHolder(holder, position);
    }


    public static String getDateText(WheelData wheelData){
        String day = wheelData.date.substring(8);
        String month = wheelData.date.substring(5, 7);
        return month + "月" + day + "日";
    }
    @Override
    public int getItemCount() {
        return wheelDataList == null ? 0 : wheelDataList.size();
    }

    public interface OnMessageDateItemListener {
        void onClick(int position, WheelData wheelData);
        void onPlay(int position);
        void onPlayTime(long time);
        void onPlayComplete();
    }
}
